package com.itheima.a;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class InputStreamTest {
    public static void main(String[] args) throws IOException {
        read1();
        System.out.println("--------------");
        read2();

    }
    public static void read1() throws IOException {
        FileInputStream fis=new FileInputStream("E:/tlias/file01.txt");

        int a;
        while ((a=fis.read())!=-1){
            System.out.println((char) a);
        }
        fis.close();

    }
    public static void read2() throws IOException {
        FileInputStream fis=new FileInputStream("E:/tlias/file01.txt");

        int len;
        byte[] bytes=new byte[3];
        while ((len=fis.read(bytes))!=-1){
            System.out.println(new String(bytes,0,len));
        }
        fis.close();

    }
}
